package com.itheima.advice;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class AddressAdvice {
    @Pointcut("execution(* com.itheima.service.UserService.getUrl(..))")
    public void pt(){}
    @Around("pt()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        Object[] args = pjp.getArgs();
        for (int i = 0; i < args.length; i++) {
            String string = args[i].toString();
            String trim = string.trim();
            args[i] = trim;
        }
        Object proceed = pjp.proceed(args);
        return proceed;
    }
}
